Turning a folder into a namespace folder

A namespace folder is a folder within the application navigator in which the included objects are automatically declared within a →namespace. The namespace is the name of the namespace folder.

The advantages of a namespace folder are:

  • Neuron Power Engineer is updating the namespace in case of actions within the application navigator, for example when objects are moved. This means that you do not have to update the namespace yourself.

  • Neuron Power Engineer is validating the objects in a namespace folder based on belonging rules. If – for example – a namespace within an object and the namespace folder do not match, this deviation is immediately reported so that you are able to correct the deviation at once.

How to create a namespace folder:

  1. Make the application navigator visible.

  2. Within the application navigator, create a subfolder below the existing folder Application. Details on how to create: See "Creating new objects and folders".

  3. Optional: Create the required objects (e.g. POUs and/or data types) in this subfolder.

    Restriction

    Avoid creating POUs with the name of a language element from the global namespace and declaring them within a namespace. Reason: At present, it is not possible to use language elements with the same name from the global namespace. This restriction applies to all language elements declared in the global namespace, but in particular to the system blocksNeuron Power Engineer changes the call of the language element declared in the global namespace to the call of the language element declared in the same namespace.
    Example: A TON block declared within the namespace Standard results in the fact that the standard TON block of the global namespace cannot be used. In particular, if Standard is provided as a namespace folder and there is a USING instruction fo this namespace folder. When calling TON, the TON block from the same namespace Standard will be called instead of the standard TON block.

  1. In the context menu of this subfolder, select Assign Namespace.
    Result:

    • The folder is displayed as a namespace folder with the icon  within the application navigator.

    • The name of the namespace folder is entered as a namespace in the existing objects.

    • If you create a new object in the namespace folder, the name of the namespace folder is also entered as a namespace in the new object. When creating an object, the field Namespace name in the wizard will be disabled.

Example for folders that are turned into namespace folders:

The folders HelperPOUs and myPOUs have been created. Each folder contains 2 function blocks.

 

The folders HelperPOUs and myPOUs have been turned into namespace folders. (They are not regular folders any longer.)
Moreover, the namespace folder HelperPOUs contains a USING instruction with the icon . Details on creating a USING instruction: See "Assigning USING for accessing a different namespace folder".

 

 

The content of one function block of each namespace folder in order to illustrate that the respective namespace has automatically been entered in the function blocks.

 
     
Good to know

(grey lightbulb) As mentioned in the introduction, Neuron Power Engineer updates the namespace within the objects of the namespace folder, when certain actions are executed in the application navigator. Hence, the following is valid:

  • How to change the current namespace for all objects within the namespace folder: Just rename the namespace folder itself. Details on renaming: See "Renaming resources".

  • How to change the namespace for only one object within the namespace folder: Move the object from the current namespace folder into a different namespace folder. Details on moving: See "Moving resources".

  • How to create a copy of an object within a different namespace folder: Copy the object in the current namespace folder. Then paste the object from the clipboard into a different namespace folder. Details on copying and pasting: See "Copying resources" and "Pasting resources".
    As an alternative, you are able to copy the namespace folder itself and paste it into a new position. In this case, the objects within the namespace folder are correspondingly copied/pasted.

  • How to delete namespace for all objects or for only one object within the namespace folder: See "Removing the namespace assignment and namespaces for objects".

(grey lightbulb) After each action in the application navigator check the messages in the Problems view whether deviations are reported. For example, that a namespace in an object and the namespace folder do not match.

(grey lightbulb) If you change a namespace within the editor of the object yourself and you save the change, a deviation to the namespace folder is also reported by Neuron Power Engineer. The best practice is to undo the change in the editor of the object.

(grey lightbulb) The name of a namespace folder is also used as namespace for objects that are located in a regular subfolder of the namespace folder.
Example 1: If the namespace folder myPOUs contains a regular folder testing, the namespace myPOUs is also used for the objects within testing. In this case, deviations to the namespace folder myPOUs are reported.
Example 2: If the namespace folder myPOUs contains the namespace folder testing instead, the namespace testing is used for the objects in testing. In this case, deviations to the namespace folder testing are reported.